<?php

/** libraries
 * http://docs.joomla.org/JToolBarHelper
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla view library
jimport('joomla.application.component.view');

class bgViewbg extends JView
{
	// Overwriting JView display method
	function display($tpl = null) 
	{
	    $model = $this->getModel();
        
        $task = &JRequest::getVar('task');
        
        switch($task){
            case 'detail':
                $cid = JRequest::getVar('id');
                
                $this->row = $model->getQuestionarDetail($cid);
                
                $list_page = $model->getListPage($cid);
                $this->list_page = implode("_",$list_page);
                                                
                $this->setLayout('detail');
            break;
            case 'end':
                $this->setLayout('end');
            break;
            
            default :
                //check submit search
                $check = &JRequest::getVar('check');
                if($check == '1')
                {
                    $this->sr = '1';
                }
                else $this->sr = '0';
                
                //search
                $this->filter = &JRequest::getVar('jform');
                                
                $this->rows = $model->getAllQuestionar($this->filter);
                $this->check = $model->check_get_sess();
                $this->pagination =& $this->get('Pagination');
                
                $this->setLayout('default');
        }
        
		parent::display();
	}
}




